#!/user/bin/env python3
# -*- coding: utf-8 -*-
"""
--------------------------------------
    Author:     JiChao_Song
    Date  :     2021/6/4 9:59
    Desc  :
--------------------------------------
"""

import os

from celery import Celery
from django.conf import settings
from django.utils import timezone


# celery设置环境变量
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'platform_auth.settings')

# 创建celery app
app = Celery('platform_auth')

# 重配置文件中获取celery配置
app.config_from_object('django.conf:settings', namespace = 'CELERY')


# 设置自动加载定时任务
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)

# 设置社区
app.now = timezone.now
